import request from '@/config/axios'

// 房产层级 VO
export interface CategoryVO {
  id: number // 编号
  name: string // 名称
  parentId: number // 父级编号
  sort:number // 排序
}

// 房产层级 API
export const CategoryApi = {
  // 查询房产层级列表
  getCategoryList: async (params: any) => {
    return await request.get({ url: `/house/category/list`, params })
  },

  // 查询房产层级详情
  getCategory: async (id: number) => {
    return await request.get({ url: `/house/category/get?id=` + id })
  },

  // 新增房产层级
  createCategory: async (data: CategoryVO) => {
    return await request.post({ url: `/house/category/create`, data })
  },

  // 修改房产层级
  updateCategory: async (data: CategoryVO) => {
    return await request.put({ url: `/house/category/update`, data })
  },

  // 删除房产层级
  deleteCategory: async (id: number) => {
    return await request.delete({ url: `/house/category/delete?id=` + id })
  },

  // 导出房产层级 Excel
  exportCategory: async (params:any) => {
    return await request.download({ url: `/house/category/export-excel`, params })
  },
}
